package com.yuyue.note01.config;

import com.yuyue.note02.controller.interceptor.ProjectInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * WebMvc配置支持实现类
 */
@Configuration
public class SpringMvcSupport extends WebMvcConfigurationSupport {
    //自动填充拦截器
    @Autowired
    private ProjectInterceptor projectInterceptor;

    @Override
    //添加拦截器
    protected void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(projectInterceptor).
                //添加拦截的路径
                addPathPatterns("/users_A","/users_A/*","/users_A/*/*");
    }
}
